As part of the PhD work of Bruno M. Guerreiro © 2024. If using this notebook, please cite the paper: https://doi.org/10.1021/acsbiomaterials.2c00075
Disclaimer: due to the changing nature of programming documentation, lab work developed and tacit knowledge in this notebook, please contact the author at bruno.guerreiro@fulbrightmail.org if something is not working properly. The code is not actively maintained.
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import plotly.express as px
import plotly.graph_objs as go
import math
### Import data
# new file (change this to assess one sample)
data = pd.read_csv("data/raw/water_bruno.csv")
# control
#water = pd.read_csv("data/INDE_cycles/water_tony.csv")
#%store water
### Convert time data from seconds to minutes
data['Time'] = data['Time']/60
### Convert strain data to only show x10E-4, then input on axis Strain * 10-4
data['Strain'] = np.multiply(data['Strain'], np.power(10, 4))
import plotly.graph_objects as go
from plotly.subplots import make_subplots
# Create figure with secondary y-axis
fig = make_subplots(specs=[[{"secondary_y": True}]])
# Add traces
fig.add_trace(
go.Scatter(x=data["Time"], y=data["Strain"], name="Strain", line_color="black", opacity=0.85),
secondary_y=False,
)
fig.add_trace(
go.Scatter(x=data["Time"], y=data["T"], name="T (ºC)", opacity=0.5, line_color="blue"),
secondary_y=True,
)
# Add figure title
#fig.update_layout(title_text="INDe nucleation cycles")
# Customizable templates, just change the 'template' arg
for template in ["plotly", "plotly_white", "plotly_dark", "ggplot2", "seaborn", "simple_white", "none"]:
fig.update_layout(template="simple_white", showlegend=False)
# Set x-axis title
fig.update_xaxes(title_text="<b>Time</b> (min)")
# Set y-axes titles
fig.update_yaxes(title_text="<b>Strain</b> (V/V*1e4)", secondary_y=False)
fig.update_yaxes(title_text="<b>Temperature</b> (ºC)", secondary_y=True)
fig.show()